package com.tom.architect.day17.simple5;

public class User implements Cloneable {
    public String userName;
    public int age;
    public Address userAddress;

    @Override
    protected User clone() throws CloneNotSupportedException {
        User user = (User) super.clone();
        // 地址clone一下，达到深拷贝。
        user.userAddress = (Address) userAddress.clone();
        return user;
    }
}
